@import '@/assets/styles/element-variables.scss';

// 下拉列表-[下拉菜单、级联、选择框]
.el-popper {
  // 下拉菜单
  .el-dropdown-menu {
    .el-dropdown-menu__item {
      padding: 6px 16px;
      color: #646566;

      &:not(.is-disabled):focus {
        background-color: #f5f7fa;
        font-weight: 500;
      }
    }

    .el-dropdown-menu__item--divided {
      margin: 10px 0;
      border-top: 1px solid #d7d9db;
    }
  }

  // 级联
  .el-cascader-menu {
    .el-cascader-node {
      padding: 0 26px 0 16px;
    }

    .el-cascader-node:not(.is-disabled):focus,
    .el-cascader-node:not(.is-disabled):hover {
      color: var(--el-color-primary);
    }

    .el-cascader-node.in-active-path,
    .el-cascader-node.is-active,
    .el-cascader-node.is-selectable.in-checked-path {
      font-weight: 500;
    }

    .el-cascader-node__postfix {
      right: 12px;
    }
  }

  // 选择框
  .el-select-dropdown {
    .el-select-dropdown__item {
      padding: 0 32px 0 16px;

      &.selected {
        font-weight: 500;
      }

      &:hover {
        color: var(--el-color-primary);
        font-weight: 500;
      }
    }

    &.is-multiple {
      .el-select-dropdown__item {
        &.selected::after {
          width: 14px;
          height: 14px;
          font-size: 14px;
          background-color: #2d2d2e;
          right: 12px;
        }
      }
    }
  }
}

// tab导航-[普通导航、卡片导航、胶囊导航]
.el-tabs {
  // 普通导航
  // --el-tabs-header-height: 48px;
  &__nav {
    height: 48px;
    line-height: 48px;

    &-wrap {
      padding: 0 18px;
    }
  }

  &__content {
    padding: 0 18px;
  }

  .el-tabs__item {
    padding: 0 20px;
    color: #2d2d2e;

    &.is-active {
      color: var(--el-color-primary);
    }

    &:hover {
      color: #46a1fb;
    }

    &:active {
      color: #0f69cf;
    }

    &.is-disabled {
      color: #c8cacc;
    }
  }

  .el-tabs__nav-wrap::after {
    height: 1px;
    background-color: #d7d9db;
  }

  // 卡片导航
  &.el-tabs--card {
    --el-tabs-header-height: 40px;

    & > .el-tabs__header {
      border-bottom: 1px solid #e4e9ed;

      .el-tabs__nav {
        border: 1px solid #e4e9ed;
        border-bottom: none;
        box-sizing: border-box;

        // overflow: hidden;
        .el-tabs__item {
          height: 38px;
          background: #f7f9fa;
          border-bottom: 1px solid transparent;

          &.is-active {
            background: #ffffff;
            border-bottom-color: #fff;
            height: 40px;
          }
        }
      }
    }
  }
}

// 胶囊导航-[采用单选框按钮组的方式]
.el-radio-group {
  .el-radio-button {
    .el-radio-button__inner {
      border: 1px solid #e4e9ed;
      border-left: 1px solid transparent;

      &:hover {
        color: #46a1fb;
      }

      &:active {
        color: #0f69cf;
      }
    }

    &:first-child {
      .el-radio-button__inner {
        border: 1px solid #e4e9ed;
      }
    }

    &.is-active {
      .el-radio-button__inner {
        border: 1px solid var(--el-color-primary);
        background-color: #fff;
        color: var(--el-color-primary);
        box-shadow: none;
        font-weight: 500;
      }
    }

    &.is-disabled {
      .el-radio-button__inner {
        background-color: #e4e9ed;
        color: #c8cacc;
      }
    }
  }
}

// 分页器
.el-pagination {
  --el-pagination-button-width: 28px !important;
  --el-pagination-button-height: 28px !important;

  .el-pagination__editor.el-input {
    width: 44px;

    .el-input__wrapper {
      padding: 1px 8px !important;
      height: 28px !important;

      .el-input__inner {
        text-align: left;
      }
    }
  }

  .el-select .el-input {
    width: 100px !important;
  }

  &.is-background {
    .el-pagination__sizes {
      margin-left: 8px;
    }

    .btn-prev,
    .btn-next {
      margin: 0 2px !important;
      border: 1px solid #d7d9db;
      background-color: #fff !important;

      .el-icon {
        font-size: 16px;
      }

      &:disabled {
        background-color: #fff !important;
      }
    }

    .btn-prev {
      margin-left: 8px !important;
    }

    .el-pager {
      li {
        margin: 0 2px !important;
        border: 1px solid #d7d9db;
        background-color: #fff !important;
        color: #2d2d2e;

        &.active {
          border: 1px solid var(--el-color-primary);
          background-color: var(--el-color-primary) !important;
        }
      }
    }

    .el-pagination__jump {
      margin-left: 8px;
    }
  }
}

// 步骤条
.el-steps {
  .el-step__head {
    .el-step__icon {
      border-color: var(--el-color-primary);
      border-width: 1px;

      .el-step__icon-inner {
        font-weight: 400;
      }
    }

    &.is-success {
      color: var(--el-color-primary);
    }

    &.is-process {
      .el-step__icon {
        background-color: var(--el-color-primary);
        color: #fff;
      }
    }

    &.is-wait {
      .el-step__line {
        background-color: #d7d9db !important;
      }

      .el-step__icon {
        border-color: #d7d9db;
        color: #9b9d9e;
      }
    }
  }

  .el-step__main {
    .el-step__title {
      margin-top: 12px;
      margin-bottom: 8px;
      color: #646566;
      font-size: 14px;
      line-height: 22px;

      &.is-process {
        color: #2d2d2e;
        font-weight: 500;
      }
    }

    .el-step__description {
      color: #646566;
      font-size: 14px;
      word-break: break-all;
      display: -webkit-box;
      -webkit-line-clamp: 3;
      -webkit-box-orient: vertical;
      overflow: hidden;
      text-overflow: ellipsis;
    }
  }

  // 横向
  &.el-steps--horizontal {
    .el-step {
      min-width: 128px;
    }

    .el-step__head {
      .el-step__line {
        height: 1px;
        width: calc(100% - 24px - 16px - 16px);
        left: calc(24px + 16px);
        background-color: var(--el-color-primary);

        .el-step__line-inner {
          border-color: var(--el-color-primary);
          // border-bottom-width: 0 !important;
        }
      }
    }
  }

  // 竖向
  &.el-steps--vertical {
    .el-step {
      min-height: 112px;
    }

    .el-step__head {
      .el-step__line {
        width: 1px;
        height: calc(100% - 24px - 8px - 8px);
        top: calc(24px + 8px);
        background-color: var(--el-color-primary);

        .el-step__line-inner {
          border-color: var(--el-color-primary);
          // border-bottom-width: 0 !important;
        }
      }
    }

    .el-step__main {
      padding-left: 12px;

      .el-step__title {
        margin: 0;
      }
    }
  }
}

// 开关
.el-switch {
  --el-switch-off-color: #c8cacc !important;

  .el-switch__core {
    min-width: 44px;
    // height: 22px;
    border-radius: 40px;

    .el-switch__action {
      width: 18px;
      height: 18px;
      left: 2px;
    }
  }

  &.is-checked {
    .el-switch__core {
      .el-switch__action {
        left: calc(100% - 20px) !important;
      }
    }
  }

  &.is-disabled {
    opacity: 0.6;
    // --el-switch-off-color: #d7d9db !important;
    // --el-switch-on-color: #75baff;
  }
}

// 徽标[圆形添加circle类，方形添加rect类]
.el-badge {
  .el-badge__content {
    min-width: 18px;
    padding: 0 4px;

    &.is-dot {
      min-width: 0;
      width: 8px;
      height: 8px;
      padding: 0;
    }
  }

  .el-badge__content--danger {
    background-color: #f24738;
  }

  &.circle {
    .el-badge__content.is-fixed {
      top: 4px;
      right: 6px;
      transform: translate(50%, -50%);

      &.is-dot {
        top: 4px;
        right: 4px;
      }
    }
  }

  &.rect {
    .el-badge__content.is-fixed {
      top: -6px;
      right: -6px;
      transform: translate(0, 0);

      &.is-dot {
        top: -2px;
        right: -2px;
      }
    }
  }
}

// 提示【气泡卡片、文字气泡、气泡确认框、全局提示、通知提醒框】
// 1气泡卡片
.el-popover {
  border: 1px solid #e8eaeb !important;
  color: #2d2d2e !important;
  min-width: auto !important;
  box-shadow: 0px 5px 5px -3px rgba(0, 0, 0, 0.1), 0px 3px 14px 2px rgba(0, 0, 0, 0.05), 0px 8px 10px 1px rgba(0, 0, 0, 0.06) !important;

  .el-popover__title {
    margin-bottom: 8px;
    line-height: 22px;
    font-size: 14px;
    color: #121314;
  }
}

// 文字气泡
.el-popper {
  padding: 5px 8px;
  font-size: 14px;
  line-height: 22px;
}

// 气泡确认框
.el-popper,
.el-popover {
  .el-popconfirm {
    .el-popconfirm__main {
      line-height: 22px;
    }

    .el-popconfirm__action {
      margin-top: 12px;

      .el-button {
        padding: 0 14px;

        &.is-text {
          border-radius: 4px;
          border: 1px solid #d7d9db;

          & > span {
            color: #2d2d2e;
          }
        }
      }
    }
  }
}

// 通知提醒框
.el-notification {
  padding: 16px;

  & > .el-notification__icon {
    width: 16px !important;
    height: 16px !important;
    margin: 3px 3px 0 0;
    color: var(--el-color-primary);

    &.el-notification--success {
      color: #1dbf6e;
    }

    &.el-notification--warning {
      color: #f47d06;
    }

    &.el-notification--info {
      color: var(--el-color-primary);
    }

    &.el-notification--error {
      color: #f24738;
    }
  }

  .el-notification__group {
    margin: 0;

    .el-notification__title {
      line-height: 22px;
      font-weight: 500;
      color: #2d2d2e;
      font-size: 14px;
    }

    .el-notification__content {
      margin-top: 16px;
      line-height: 22px;
    }
  }
}

// 全局提示
.el-message {
  padding: 13px 16px;

  &.el-message--success {
    border-color: #1dbf6e;
    background-color: #e8fff4;
  }

  &.el-message--warning {
    border-color: #f47d06;
    background-color: #fff7e8;
  }

  &.el-message--info {
    border-color: var(--el-color-primary);
    background-color: #e8f4ff;
  }

  &.el-message--error {
    border-color: #f24738;
    background-color: #ffeee8;
  }

  .el-message__icon {
    font-size: 16px;
    margin-right: 8px;

    &.el-message-icon--success {
      color: #1dbf6e;
    }

    &.el-message-icon--warning {
      color: #f47d06;
    }

    &.el-message-icon--info {
      color: var(--el-color-primary);
    }

    &.el-message-icon--error {
      color: #f24738;
    }
  }

  .el-message__content {
    line-height: 22px;
    color: #2d2d2e !important;
  }
}

// 弹窗-【确认框、Dialog 对话框】
.el-message-box {
  position: relative;
  width: 480px !important;
  max-width: 480px !important;
  padding: 24px 24px 24px 56px;
  border: none;

  .el-message-box__header {
    padding: 0;

    .el-message-box__title {
      padding-right: 24px;
      line-height: 24px;
      font-size: 16px;
      color: #2d2d2e;
    }

    .el-message-box__headerbtn {
      top: -8px;
      right: -8px;
    }
  }

  .el-message-box__content {
    padding: 16px 0 0;

    .el-message-box__container {
      position: static;

      .el-message-box__status {
        left: 24px;
        top: 24px;
        transform: translate(0);

        &.el-message-box-icon--success {
          --el-messagebox-color: #1dbf6e;
        }

        &.el-message-box-icon--info {
          --el-messagebox-color: var(--el-color-primary);
        }

        &.el-message-box-icon--warning {
          --el-messagebox-color: #f47d06;
        }

        &.el-message-box-icon--error {
          --el-messagebox-color: #f24738;
        }
      }

      .el-message-box__message {
        padding: 0;
        line-height: 22px;
        color: #646566;

        p {
          line-height: 22px;
        }
      }
    }
  }

  .el-message-box__btns {
    padding: 8px 0 0;
    margin-top: 24px;

    .el-button--default {
      color: #2d2d2e;
      background: #ffffff;
      border: 1px solid #d7d9db;

      &:hover {
        color: #46a1fb;
      }

      &:active,
      &:focus {
        color: #0f69cf;
      }

      &:disabled {
        color: #c8cacc;
        background: #f7f9fa;
        border: 1px solid #dcdee0;
      }
    }

    .el-button--primary {
      color: #fff !important;
      margin-left: 8px !important;
      background-color: #1989fa !important;

      &:hover {
        background: #46a1fb !important;
      }

      &:active {
        background: #0f69cf !important;
      }

      &:disabled {
        background: #cce7ff !important;
      }
    }

    // .el-button--primaray:hover {
    //   background-color: #46a1fb !important;
    // }
  }
}

// Dialog 对话框
// tip 宽度480 class='small'; 宽度640 默认; 宽度880 class='large';
.el-dialog__wrapper {
  display: flex;
  justify-content: center;
  align-items: center;

  .el-dialog {
    max-height: 80vh;
    border-radius: 4px;
  }

  &.small {
    .el-dialog {
      width: 480px !important;
    }
  }

  &.large {
    .el-dialog {
      width: 880px !important;

      .el-table .my-cell {
        vertical-align: top;
      }
    }
  }

  &.oversized {
    .el-dialog {
      width: 75vw !important;
    }
  }

  .el-dialog {
    width: 640px !important;
    border-radius: 4px;
  }

  .el-dialog__header {
    padding: 16px 24px;
    margin: 0;
    border-bottom: 1px solid #d7d9db;

    .el-dialog__title {
      line-height: 24px;
      font-size: 16px;
      font-weight: 500;
      color: #2d2d2e;
    }

    .el-dialog__headerbtn {
      width: 56px;
      height: 56px;
      top: 0;
      right: 0;

      .el-dialog__close {
        color: #9b9d9e;
      }
    }
  }

  .el-dialog__body {
    min-height: calc(240px - 120px);
    max-height: calc(80vh - 120px) !important;
    padding: 24px !important;
    // margin: 24px 0;
  }

  .el-dialog__footer {
    padding: 8px 24px 24px 24px;
    border-top: none !important;
  }
}

.el-overlay {
  .el-overlay-dialog {
    .el-dialog {
      .el-dialog__body {
        padding: 24px !important;
      }
    }
  }
}

// 抽屉
.el-drawer__wrapper {
  --flex-direction: column;
  --form-item-width: 100%;

  .el-drawer__header {
    padding: 16px 20px;
    margin: 0 !important;
    box-shadow: inset 0px -1px 0px 0px #d7d9db;

    span {
      font-size: 16px;
      font-weight: bold;
      color: #121314;
      line-height: 24px;
    }
  }

  .el-drawer__body {
    padding: 16px 20px;
    flex: none !important;
    height: calc(100% - 120px);
    overflow-x: hidden;

    .drawer-form {
      display: flex;
      flex-wrap: wrap;
      width: calc(100% + 28px);

      .el-form-item {
        display: flex;
        flex-direction: var(--flex-direction);
        width: var(--form-item-width);
        margin-bottom: 16px;
        margin-right: 0 !important;
        padding-right: 28px;

        .el-form-item__label {
          font-size: 14px;
          font-weight: 400;
          color: #757778;
          line-height: 22px;
          margin-bottom: 2px;

          &::before {
            font-size: 14px;
            color: #f24738;
          }
        }
      }

      .form-item-part {
        width: var(--form-item-part);
      }

      .el-form-item__content {
        flex: 1;
        line-height: 32px !important;
        margin-left: 0 !important;

        .el-date-editor {
          width: 100%;
        }

        .el-select {
          width: 100%;
        }

        .el-cascader,
        .el-cascader--medium {
          width: 100%;
        }

        .el-textarea {
          .el-textarea__inner {
            color: #2d2d2e;
            // overflow: scroll;
          }
        }
        .el-textarea.is-disabled .el-textarea__inner {
          color: #c0c4cc;
        }
        .el-input-number {
          width: 100%;

          &--medium {
            line-height: 32px;
          }

          .el-input-number__decrease {
            line-height: 13px !important;
          }
        }

        .el-input.is-disabled {
          .el-input__inner {
            color: #2d2d2e !important;
          }
        }

        .el-textarea.is-disabled {
          .el-textarea__inner {
            color: #2d2d2e !important;
          }
        }

        .el-range-editor.is-disabled {
          input {
            color: #2d2d2e !important;
          }
        }

        .el-radio__input.is-disabled.is-checked .el-radio__inner::after {
          background: #757778 !important;
        }

        .el-input {
          &__inner {
            color: #2d2d2e;
          }
        }
      }

      .uploadFile {
        .el-upload {
          width: 104px;
          height: 104px;
          line-height: 102px;
        }

        .el-upload-list__item {
          width: 104px;
          height: 104px;
        }
      }
    }
  }

  .drawer-footer {
    position: absolute;
    right: 0;
    width: 100%;
    background: #ffffff;
    box-shadow: 0px -2px 4px 0px rgba(0, 0, 0, 0.06);
    display: flex;
    bottom: 0;
    align-items: center;
    justify-content: flex-end;
    padding: 16px 20px;
  }
}

.drawer-large {
  width: 816px !important;
}

// 区域组件外层
.address-part {
  .dialog-form {
    margin-right: -8px;
  }

  .el-form-item {
    padding-right: 8px;

    .el-form-item__content {
      padding-right: 0;
    }
  }
}

// .el-input--prefix .el-input__inner {
//   padding-left: 15px !important;
// }

.el-input-number {
  input::placeholder {
    text-indent: 15px;
  }

  input:hover {
    &::placeholder {
      text-indent: 6px;
    }
  }
}
